<!-- 教程 -->
<template>
  <div class="teach-container">
    <div class="left">
      <el-card shadow="always" :body-style="	{ padding: '0px' }" class="titl">
        <div class="ltitle">
          <el-autocomplete
            class="inline-input"
            v-model="inputinfo"
            :fetch-suggestions="querySearch"
            placeholder="请输入要搜索的教程"
            :trigger-on-focus="false"
            @select="handleSelect"
          >
            <i slot="suffix" class="el-input__icon el-icon-search"></i>
          </el-autocomplete>
        </div>
        <div class="selected">
          <el-button v-for="tab in tabs" :key="tab">{{tab}}</el-button>
        </div>
      </el-card>
      <el-card
        shadow="hover"
        :body-style="	{ padding: '0px' }"
        class="talk-card"
        v-for="card in 5"
        :key="card"
      >
        <div class="talk-face">
       
            <router-link to="/home/talkcon">
             <img src="@/images/1.png" alt width="150px" height="150px">
             </router-link>
               
         
        </div>
        <div class="main">
          <div class="talk-title">
            <span>佳能尼康哪个好</span>
          </div>
          <div class="talk-con">
            <span>就选择佳能和尼康做一个简单的</span>
          </div>
        </div>
        <div class="sign">
          <div class="s-left">
            <img src="@/assets/icon1/sign.svg" height="25px">&nbsp;
            <el-button size="mini" v-for="sign in signs" :key="sign">{{sign}}</el-button>
          </div>
          <div class="s-right">
            <span>ice摄影师|133阅读量</span>
            <span>30喜欢</span>
            <span>30评论</span>
          </div>
        </div>
      </el-card>
      <div class="fenye" style="text-align:center;margin:80px auto;">
        <el-pagination background layout="prev, pager, next" :total="1000"></el-pagination>
      </div>
    </div>
    <el-card shadow="hover" :body-style="	{ padding: '0px' }" class="intro">
      <div class="title">
        <span>热门讨论区</span>
      </div>
      <div class="right" v-for="item in 6" :key="item">
        <img src="@/images/icon.jpg" alt width="30px">
        
        <span>观点话题</span>
      </div>
    </el-card>
  </div>
</template>

<script>
export default {
  data() {
    return {
      tabs: ["所有", "人像", "后期修图", "手机拍照", "器材应用", "拍摄技巧"],
      inputinfo: "",
      restaurants: [],
      signs: ["人像", "佳能"]
    };
  },

  methods: {
    querySearch(queryString, cb) {
      var restaurants = this.restaurants;
      var results = queryString
        ? restaurants.filter(this.createFilter(queryString))
        : restaurants;
      // 调用 callback 返回建议列表的数据
      cb(results);
    },
    createFilter(queryString) {
      return restaurant => {
        return (
          restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) ===
          0
        );
      };
    },
    loadAll() {
      return [
        { value: "三全鲜食（北新泾店）", address: "长宁区新渔路144号" },
        {
          value: "Hot honey 首尔炸鸡（仙霞路）",
          address: "上海市长宁区淞虹路661号"
        },
        {
          value: "新旺角茶餐厅",
          address: "上海市普陀区真北路988号创邑金沙谷6号楼113"
        },
        { value: "泷千家(天山西路店)", address: "天山西路438号" }
      ];
    },
    handleSelect(item) {
      console.log(item);
    }
  },
  mounted() {
    this.restaurants = this.loadAll();
  }
};
</script>
<style lang='scss' scoped>
.teach-container {
  margin: 50px 150px;
  display: flex;
  justify-content: space-between;
  .title {
    background-color: #f5f5f5;
    height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;

    span {
      font-size: 16px;
      letter-spacing: 3px;
      font-weight: bold;
    }
  }
  .left {
    width: 75%;
    .ltitle {
      background-color: #f5f5f5;
      height: 100px;
      padding: 50px 100px;
      .inline-input {
        width: 90%;
        height: 45px;
        line-height: 40px;
        border-radius: 25px;
        .el-input__icon {
          height: 50%;
          width: 40px;
        }
      }
    }
    .selected {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 0 100px;
      height: 100px;
      background-color: #f5f5f5;
    }
    .talk-card {
      height: 230px;
      margin-top: 20px;
      .talk-face {
        float: left;
        width: 190px;
        height: 190px;
        padding: 20px 25px;
        img {
          box-shadow: 1px 1px 2px 2px #eee;
        }
      }
      .main {
        padding: 20px 30px;
        height: 190px;
        margin-left: 130px;
        .talk-title {
          overflow-y: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;
          span {
            line-height: 30px;
            font-size: 30px;
            letter-spacing: 3px;
            font-weight: bold;
          }
        }
        .talk-con {
          padding: 20px 0;

          span {
            letter-spacing: 2px;
            font-size: 18px;
            color: #909399;
          }
        }
      }
    }
    .sign {
      display: flex;
      justify-content: space-between;
      height: 40px;
      width: 100%;
      padding: 0 20px;
      .el-button {
        border-radius: 10px;
        color: #909399;
      }
      .s-right {
        span {
          font-size: 16px;
          color: #909399;
          letter-spacing: 2px;
          margin-left: 20px;
        }
      }
    }
  }
  .intro {
    width: 23%;
    height: auto;
    span {
      font-size: 15px;
      letter-spacing: 2px;
      line-height: 25px;
    }
    .right {
      height: 50px;
      border: 1px solid;
      display: flex;
      align-items: center;
      span {
        margin-left: 20px;
      }
    }
  }
}
</style>